RcppArmadillo and OpenMP workflow

  1. Add the following to your C++ source code to use OpenMP, and tell Rcpp that you need to include that in the compiler:

  2. Tell the compiler that you’ll be running a block in parallel with openmp

    You’ll need to specify how OMP should handle the data:

    • shared: Default, all threads access the same copy.
    • private: Each thread has its own copy (although not initialized).

    Setting default(none) is a good practice.



slide 22/30
* help? Contents OCRUG August 2019